1. Field of the Invention
The present invention relates to digital computing, and more particularly to an apparatus and method for a dynamic partitionable saturating adder/subtractor.
2. Description of the Related Art
Where wide adders exist in a design, it is desirable for some computation workloads (such as graphics processing) to selectively partition the adders such that they may perform several independent operations in parallel on a set of operands. Also useful in these workloads is the independent feature of saturating arithmetic.
U.S. Pat. No. 5,448,509, issued to Lee et al., describes a system for handling positive and negative overflow and performing saturation. However, Lee '509 suffers several shortcomings that are overcome by the present invention. First, Lee '509 is not partitionable while the present invention is partitionable. Also, Lee '509 restricts itself to several rather unusual combinations of inputs and outputs: the addition of an unsigned operand to a signed operand to produce an unsigned saturable result, and the addition of two signed operands to produce a positive-only signed result. In the latter case, the Lee '509 invention deprives the result of half its possible range. This is because Lee '509 saturates underflow at zero, rather than the largest negative number, -2.sup.(N-`). While Lee ' 509 saturates overflow at 2.sup.(N-1) -1, the usual value for signed overflow, the zero saturation for underflow deprives the result of half of its possible range. In contrast, the present invention provides a saturating capability that takes signed inputs to produce a full range signed output or takes unsigned inputs and produces an unsigned output. Finally, Lee '509 examines the final result of the arithmetic operation to determine overflow or underflow. In contrast, the present invention discloses a more efficient method of determining overflow and underflow through the use of carry-lookahead logic to detect overflow/underflow before the result is computed.
The present invention also discloses a more desirable approach than that described in U.S. Pat. No. 5,164,914, issued to Daryl E. Anderson. Anderson '914 describes an approach for a saturating adder in which the carry into the most significant result bit is used to detect overflow. Because Anderson '914 does not disclose a partitionable adder, and because Anderson '914 restricts itself to signed saturation, it has limited usefulness.
The invention described herein combine a selectable arithmetic operation (addition, subtraction) and selectable saturating modes (signed, unsigned) with selectable partitioning (8-bit, 16-bit, 32-bit). The present invention also provides selectable add/subtract capability for a 64-bit partition, but does not support saturation for 64-bit partitioning. The present invention is implemented in the dynamic N-nary logic design style, to create a versatile high-performance adder/subtractor. The present invention overcomes the deficiencies of the prior art in that it combines signed and unsigned saturating arithmetic with partitionability, which allows the adder/subtractor to perform a larger number of narrow additions or a smaller number of wider additions.